//
//  DNApiForUserLogin.swift
//  LunalerApp
//
//  Created by 露乐ios on 2018/3/3.
//  Copyright © 2018年 露乐ios. All rights reserved.
//

import UIKit
import SolarNetwork

class DNApiForUserLogin: DNApiBaseRequest {
    
    override func loadRequest() {
        super.loadRequest()
        self.method = .post
        self.path = "/api/base/account/login"
        self.modelClass = DNUserBaseInfoModel.self
    }
    
    init(LoginIdOrPhone:NSString,HashedPassword:NSString,VerifyCode:NSString) {
        super.init()
        self.LoginIdOrPhone = LoginIdOrPhone as String
        let hashedPasswordInfo = HashedPassword.appending(DNAppContext.shareInstance.kSaltStr) as NSString
        self.HashedPassword = hashedPasswordInfo.md5() as String
        self.VerifyCode = VerifyCode as String
    }
    
    let TenantId = "0"
    var LoginIdOrPhone = ""
    var HashedPassword = ""
    var VerifyCode = ""
    let DeviceType = "4"
    let ClientId = ""
    let Application = "1"
    
}

class DNApiBaseRequest: SLRequest {
    public var modelClass = DNResponseBaseModel.self
    override func loadRequest() {
        super.loadRequest()
        if DNUserContext.sharedInstance.token != nil {
              self.headers = ["Authorization":dnNullStrable(str: DNUserContext.sharedInstance.token ?? "") as String];
        }
    }
}
